package com.example.mylibrarybase.yumengmeng11.ui;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.PopupWindow;
import android.widget.TextView;

import com.example.mylibrarybase.R;
import com.example.mylibrarybase.bar.initAction_Bar;
import com.example.mylibrarybase.base.baseui.BaseActivity;
import com.example.mylibrarybase.utils.LogUtils;
import com.example.mylibrarybase.yumengmeng11.utils.popwindowUtils.PopWindowUtils_11;

import java.util.ArrayList;

public class MainActivity_popwindow_11 extends BaseActivity {

    private initAction_Bar mBase_action_bar;
    private TextView mPopwindow_tv;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        initView();
    }

    @Override
    public int getlayouXML() {
        return R.layout.activity_main_popwindow_11;
    }

    @Override
    public void initView() {
        mBase_action_bar = (initAction_Bar) findViewById(R.id.base_action_bar);
        mBase_action_bar
                .setMode(initAction_Bar.AUTO_ONCLICK_MODE)
                .setCallBack(new initAction_Bar.Action_bar_call_back() {
            @Override
            public void getAction_barView_backbutton(TextView textView) {
            }

            @Override
            public void getAction_barView_backbutton_icon(ImageView imageView) {

            }

            @Override
            public void getAction_barView_title(TextView textView) {
                textView.setText("popwindow");
            }

            @Override
            public void getAction_barView_right_icon(ImageView imageView) {

            }
        });

        mPopwindow_tv = (TextView) findViewById(R.id.popwindow_tv);
        mPopwindow_tv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ArrayList<String> strings = new ArrayList<>();
                for (int i = 0; i < 10; i++) {
                    strings.add(i+"");
                }
                PopWindowUtils_11.showPopupWindow(MainActivity_popwindow_11.this, strings, mPopwindow_tv, 10, 10, MainActivity_popwindow_11.this, new PopWindowUtils_11.Callback() {
                    @Override
                    public void getString(String itemName, int postion) {
                        LogUtils.i("我点的是"+itemName+"号是"+postion);
                    }

                    @Override
                    public void getWindow(PopupWindow popupWindow) {

                    }
                });
            }
        });
    }

    @Override
    public void initData() {

    }
}
